Skip to content

Conversation

@ljmay168
Copy link
Contributor

@ljmay168 ljmay168 commented Oct 11, 2025

Link issues

fixes #6877

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Fix auto-fit column width when detail row feature is enabled by adjusting row selection logic in Table.razor.js

Bug Fixes:

  • Correct row selection in autoFitColumnWidth to use the proper tbody for tables with detail rows to exclude detail rows
  • Convert rows collection to array and filter out detail rows before calculating max cell width

@bb-auto
Copy link

bb-auto bot commented Oct 11, 2025

Thanks for your PR, @ljmay168. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 11, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Fixed column auto-fit width calculation by iterating the correct table bodies and filtering out detail rows, ensuring accurate width determination when detail rows are enabled.

Sequence diagram for auto-fit column width calculation with detail rows

sequenceDiagram
participant Table
participant "autoFitColumnWidth()"
participant "Table Body Rows"
participant "Cell"
Table->>"autoFitColumnWidth()": Trigger auto-fit for column
"autoFitColumnWidth()"->>"Table Body Rows": Enumerate rows, filter out .is-detail
"Table Body Rows"->>"Cell": For each row, get cell at column index
"autoFitColumnWidth()"->>"Cell": Calculate cell width
"autoFitColumnWidth()"->>Table: Update column width with max value
Loading

Class diagram for updated autoFitColumnWidth logic

classDiagram
class Table {
  thead
  body
  tables
}
class autoFitColumnWidth {
  +async (table, col)
}
Table <|-- autoFitColumnWidth
class TableBodyRow {
  +classList
  +cells
}
autoFitColumnWidth --> TableBodyRow: iterates and filters
TableBodyRow --> Cell: contains cells
class Cell {
  +width
}
autoFitColumnWidth --> Cell: calculates width
Loading

File-Level Changes

Change Details Files
Handle detail rows correctly in width calculation
  • Replace querySelectorAll with direct table.tables[] tBodies[0].rows enumeration
  • Filter out rows with 'is-detail' class before measuring
src/BootstrapBlazor/Components/Table/Table.razor.js
Streamline row iteration
  • Remove unnecessary spread operator on rows array
  • Use rows.forEach directly for width computation
src/BootstrapBlazor/Components/Table/Table.razor.js
Update project packaging metadata
  • Apply changes to BootstrapBlazor.csproj for packaging consistency
src/BootstrapBlazor/BootstrapBlazor.csproj

Assessment against linked issues

Issue Objective Addressed Explanation
#6877 Fix the bug where double-clicking the main table column header to auto-fit column width does not work correctly when detail rows with nested tables are expanded.
#6877 Ensure that auto-fit column width only calculates widths based on rows in the main table, excluding detail rows and nested tables.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto bot requested a review from ArgoZhang October 11, 2025 11:37
@bb-auto bb-auto bot added the bug Something isn't working label Oct 11, 2025
@bb-auto bb-auto bot added this to the 9.11.0 milestone Oct 11, 2025
sourcery-ai[bot]
sourcery-ai bot previously approved these changes Oct 11, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Oct 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a31fcaa) to head (ed5696d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #6878   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          739       739           
  Lines        31765     31765           
  Branches      4466      4466           
=========================================
  Hits         31765     31765           
Flag Coverage Δ
BB 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ArgoZhang
ArgoZhang previously approved these changes Oct 12, 2025
@ArgoZhang ArgoZhang changed the title fix(Table): 表格列适应列宽在表格明细行中有嵌套表格时不正常 #6877 fix(Table): column auto-fit width not working when enable detail row function Oct 12, 2025
@ArgoZhang ArgoZhang dismissed stale reviews from sourcery-ai[bot] and themself via 0820736 October 12, 2025 00:57
@ArgoZhang
Copy link
Member

@sourcery-ai summary

@ArgoZhang
Copy link
Member

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang ArgoZhang changed the title fix(Table): column auto-fit width not working when enable detail row function fix(Table): column auto-fit width not working on detail mode Oct 12, 2025
@ArgoZhang ArgoZhang merged commit 27d65b3 into dotnetcore:main Oct 12, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(Table): 表格列适应列宽在表格明细行中有嵌套表格时不正常

2 participants